package com.zhiyou100.reflect;

public class Demo2 {

    public static void main(String[] args) {
        //获取Class字节码对象
        Class<User> userClass = User.class;
        User user = new User();
        Class<? extends User> aClass = user.getClass();
        String name = userClass.getName();
        System.out.println("类名称：" + name);
        Package aPackage = userClass.getPackage();
        System.out.println("包：" + aPackage.getName());
        Class<? super User> superclass = userClass.getSuperclass();
        System.out.println("父类：" + superclass.getName());
        Class<UserDaoImpl> daoClass = UserDaoImpl.class;
        Class<?>[] interfaces = daoClass.getInterfaces();
        for (Class<?> anInterface : interfaces) {
            System.out.println("接口："+anInterface.getName());
        }
        System.out.println("user是否为基本类型：" + userClass.isPrimitive());

    }

}
